<?php

namespace Viettrans\FrontBundle\Form\NoPersist;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\DependencyInjection\Container;

use Viettrans\FrontBundle\Form\ChoiceList\CategoriesList;

class Search extends AbstractType {
    private $container;
    
    public function __construct(Container $container) {
        $this->container = $container;
    }
    
    public function buildForm(FormBuilder $builder, array $options) {
        $builder->add('keyword', 'text', array(
            'label'    => 'Từ khóa',
            'required' => false,
        ));
        
        $myChoicesListManager = $this->container->get('my_choices_list_manager');

        $builder->add('categoryId', 'choice', array(
            'label'       => 'Danh mục',
            'choice_list' => $myChoicesListManager->getCategories(true, true),
            'expanded'    => false,
            'multiple'    => false,
            'required'    => false,
        ));
        
        $builder->add('locality', 'text', array(
        	'label'     =>'Thành phố',
            'required'  => false,
        ));
    }
}